package com.netrust.cmsx.entity.module.site;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @title
 * @description 宣传管理实体类
 * @author ZYC
 * @version v_1.0.0
 * @date 2017年7月4日 上午9:02:45
 */

@Entity
@Table(name = "t_site_propaganda")
public class SitePropaganda implements Serializable {

	private static final long serialVersionUID = 7252032892387667989L;

	public static final String TYPE_TXT = "txt";
	public static final String TYPE_PIC = "pic";
	public static final String TYPE_AD = "ad";

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "sp_id", columnDefinition = "int(11)", nullable = false, unique = true)
	private Integer id;// 主键

	@Column(name = "sp_p_id", columnDefinition = "int(11)")
	private Integer pId;// sp_id是自关联【多对一】

	@Column(name = "sp_type", columnDefinition = "varchar(10)", nullable = false)
	private String type;// 链接类型

	@Column(name = "sp_title", columnDefinition = "varchar(100)", nullable = false)
	private String title;// 名称

	@Column(name = "sp_summary", columnDefinition = "varchar(50)")
	private String summary;// 概要

	@Column(name = "sp_content", columnDefinition = "varchar(1000)")
	private String content;// 内容

	@Column(name = "sp_link_path", columnDefinition = "varchar(200)")
	private String linkPath;// 返回地址

	@Column(name = "sp_remark", columnDefinition = "varchar(100)")
	private String remark;// 备注

	@Column(name = "sp_preview_url", columnDefinition = "varchar(200)")
	private String previewUrl;// 预览图片

	@Column(name = "sp_cover_url", columnDefinition = "varchar(200)")
	private String coverUrl;// 图标地址

	@Column(name = "sc_place", columnDefinition = "int(11)")
	private Integer place;// 排序

	@Transient
	private List<SitePropaganda> child = new ArrayList<SitePropaganda>();
	// 自关联
	// @JsonIgnore
	// @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL },
	// mappedBy = "sitePropaganda")
	// private List<SitePropaganda> child = new ArrayList<>();
	//
	// @JsonIgnore
	// @ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
	// @JoinColumn(name = "pId")
	// private SitePropaganda sitePropaganda;

	public SitePropaganda() {
	}

	/**
	 * 
	 * @param id
	 * @param pId
	 * @param type
	 * @param title
	 * @param summary
	 * @param content
	 * @param linkPath
	 * @param remark
	 * @param previewUrl
	 * @param coverUrl
	 * @param place
	 */
	public SitePropaganda(Integer id, Integer pId, String type, String title, String summary, String content,
			String linkPath, String remark, String previewUrl, String coverUrl, Integer place) {
		this.id = id;
		this.pId = pId;
		this.type = type;
		this.title = title;
		this.summary = summary;
		this.content = content;
		this.linkPath = linkPath;
		this.remark = remark;
		this.previewUrl = previewUrl;
		this.coverUrl = coverUrl;
		this.place = place;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getpId() {
		return pId;
	}

	public void setpId(Integer pId) {
		this.pId = pId;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getLinkPath() {
		return linkPath;
	}

	public void setLinkPath(String linkPath) {
		this.linkPath = linkPath;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getPreviewUrl() {
		return previewUrl;
	}

	public void setPreviewUrl(String previewUrl) {
		this.previewUrl = previewUrl;
	}

	public String getCoverUrl() {
		return coverUrl;
	}

	public void setCoverUrl(String coverUrl) {
		this.coverUrl = coverUrl;
	}

	public Integer getPlace() {
		return place;
	}

	public void setPlace(Integer place) {
		this.place = place;
	}

	public List<SitePropaganda> getChild() {
		return child;
	}

	public void setChild(List<SitePropaganda> child) {
		this.child = child;
	}

	// public SitePropaganda getSitePropaganda() {
	// return sitePropaganda;
	// }
	//
	// public void setSitePropaganda(SitePropaganda sitePropaganda) {
	// this.sitePropaganda = sitePropaganda;
	// }

	@Override
	public String toString() {
		return "SitePropaganda [id=" + id + ", pId=" + pId + ", type=" + type + ", title=" + title + ", summary="
				+ summary + ", content=" + content + ", linkPath=" + linkPath + ", remark=" + remark + ", previewUrl="
				+ previewUrl + ", coverUrl=" + coverUrl + ", place=" + place + "]";
	}

}
